#-*- coding:utf-8 -*-
from pymongo import MongoClient
#

def MonClient():
    "进行mongodb连接"
    conn = MongoClient('127.0.0.1',27017)
    db = conn['admin']
    db.authenticate('root','abc123')
    #切换数据库
    db = conn.ok
    
    #获得文档对象
    collection = db.st.findOne()
    
    
    col = db.st.find()
    
    #迭代输出内容
    
    for item in col:
       print(item)
       
       #访问属性值
       print(item["name"])
    
    
    
    
    
    
    
    



    
#http://blog.csdn.net/callinglove/article/details/45668673
#http://api.mongodb.com/python/current/
#http://www.cnblogs.com/2010Freeze/archive/2012/06/25/2560863.html
#http://www.oschina.net/question/54100_27233
